package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._1工厂模式._计算器1;

import java.util.Scanner;

/**
 * @ClassName Test
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/9 8:04 PM
 * @Version 1.0
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字A：");
        String A = sc.nextLine();
        System.out.println("请选择运算符号(+、-、*、/)：");
        String B = sc.nextLine();
        System.out.println("请输入数字B：");
        String C = sc.nextLine();
        double D = 0d;

        if (B.equals("+"))
            D = Double.parseDouble(A) + Double.parseDouble(C);
        if (B.equals("-"))
            D = Double.parseDouble(A) - Double.parseDouble(C);
        if (B.equals("*"))
            D = Double.parseDouble(A) * Double.parseDouble(C);
        if (B.equals("/"))
            D = Double.parseDouble(A) / Double.parseDouble(C);

        System.out.println("结果是："+D);
    }
}
